#ifndef _OGREAPPLICATION_H_
#define _OGREAPPLICATION_H_
#include <OgrePrerequisites.h>
#include <OgreVector3.h>

class OgreApplication
{
public:
  OgreApplication(void);
  virtual ~OgreApplication(void);

  static Ogre::SceneManager* getSceneManager(void) {return mpsSceneMgr;}

  void setPluginsPath(const Ogre::String& path);
  void setResourcePath(const Ogre::String& path);
  void setConfigPath(const Ogre::String& path);
  void setSceneManagerParams(const Ogre::String& name, 
    int type);
  void setDefaultCameraParams(const Ogre::String& name,
    const Ogre::Vector3& pos,  const Ogre::Vector3& lookAt);

  virtual bool setup(void);

  void beginRenderLoop(void);
  void renderOneFrame(void);

protected:
  // Setup Step 1
  virtual void setupResources(void);

  // Setup Step 2
  virtual bool configure(void);

  // Setup Step 3
  virtual void chooseSceneManager(void);

  // Setup Step 4
  virtual void setupCamera(void);

  // Setup Step 5 (optional)
  virtual void createResourceListener(void) {}

  // Setup Step 6
  virtual void loadResources(void);

  // Setup Step 7 (optional)
  virtual void initScene(void) {}

  // Called when renderOneFrame is called after frameStated is fired but 
  // before renderOneFrame is called
  virtual void update(float timeSinceLastUpdate) {}

protected:
  static Ogre::SceneManager*   mpsSceneMgr;

  Ogre::Root*           mpRoot;
  Ogre::Camera*         mpCamera;
  Ogre::Viewport*       mpViewport;
  Ogre::RenderWindow*   mpWindow;
	Ogre::String          mResourcePath;
	Ogre::String          mConfigPath;
  Ogre::String          mPluginsPath;
  int                   mSceneMgrType;
  Ogre::String          mSceneMgrName;
  Ogre::String          mDefaultCameraName;
  Ogre::Vector3         mDefaultCameraPos;
  Ogre::Vector3         mDefaultCameraLookAt;
};

#endif // _OGREAPPLICATION_H_